package com.yuncheng.spcyApi.constant.flow;

import com.yuncheng.spcyApi.constant.common.SpcyConstant;
import org.springframework.stereotype.Component;

@Component(value = "ybjcyFlowConstant")
public class YbjcyFlowConstant implements FlowConstant {

    public final static String NODENAME = "个人总结,组长评价,经办人审核";

    public final static String HJMC_DJ = "个人总结";
    public final static String HJMC_SH = "组长评价";
    public final static String HJMC_SP = "经办人审核";

    // 流程办理按钮类型 - 保存
    public final static String SUBMIT_TYPE_SAVE = "0";

    // 流程办理按钮类型 - 提交
    public final static String SUBMIT_TYPE_SUBMIT = "1";

    @Override
    public String getNextNodeName(String currentNodeName) {
        String nodeNameList[] = NODENAME.split(",");
        for (int i=0; i<nodeNameList.length; i++){
            if (nodeNameList[i].equals(currentNodeName)){
                if (i == nodeNameList.length-1){
                    return HJMC_LCJS;
                }else {
                    return nodeNameList[i+1];
                }
            }
        }
        return "";
    }

    // 获取上一个环节名称
    public String getPreviousName(String nowNodeName){
        String[] nodeNameList = NODENAME.split(",");

        for (int i=0; i<nodeNameList.length; i++){
            if (nodeNameList[i].equals(nowNodeName)){
                if (i==0){
                    return nodeNameList[i];
                }else {
                    int perviousI = i-1; // 上一个环节名称
                    return nodeNameList[perviousI];
                }
            }
        }
        return "";
    }

    @Override
    public String getSpNextNodeName(String currentNodeName) {
        return null;
    }

    @Override
    public String getSpPreviousName(String currentNodeName) {
        return null;
    }

    @Override
    public String getFirstNode() {
        String nodeNameList[] = NODENAME.split(",");
        return nodeNameList[0];
    }

    @Override
    public String getBlfs(String nodeName) {
        return SpcyConstant.BLFS_DRJJ;
    }

    @Override
    public String getFywflcode() {
        return "ybjcy001";
    }

    @Override
    public String getFlowName() {
        return "见习考评-考评流程";
    }
}
